package main

import (
	"fmt"
	"sort"
)

func main() {
	arr := []int{2, -11, 24, 15, 26, -31, 2, -48, -49, 22, 37, -36}
	arr1 := make([]int, len(arr))
	copy(arr1, arr)
	sort.Ints(arr)
	// 去重, 获得排序的map
	flag_map := make(map[int]int)
	flag := 1
	for _, v := range arr {
		if _, ok := flag_map[v]; !ok {
			flag_map[v] = flag
			flag++
		}
	}

	end_ls := []int{}
	for _, v := range arr1 {
		end_ls = append(end_ls, flag_map[v])
	}
	fmt.Println(end_ls)
}
